﻿#define _CRT_SECURE_NO_WARNINGS//模拟实现strncat
#include<stdio.h>
#include<string.h>
char* my_strncat(char* p1, char* p2, size_t n)
{
	char* p = p1;
	while (*p1 != '\0')
	{
		p1++;
	}
	while (n)
	{
		*p1 = *p2;
		p1++;
		p2++;
		n--;

	}
	return p;
}
int main()
{
	char arr1[20] = "abcdef";
	char arr2[] = "mmmmmmm";
	/*strncat(arr1, arr2, 5);*/
	printf("%s\n", arr1);
	char* pp = my_strncat(arr1, arr2, 5);
	printf("%s\n", pp);
	return 0;
}